DAS_PurgeEmptyLayers.mcr
April, 2015
version 1.0

USE AT YOUR OWN RISK. Author assumes no responsibility.

Instructions:
Put the enclosed macroscript in your "macroscripts" sub-directory of 3ds max.
This can be the user macros folder located under your installation profile:
i.e. "C:\Users\admin\AppData\Local\Autodesk\3dsMaxDesign\2015 - 64bit\ENU\usermacros" 

Or the root macroscripts folder within the 3ds max installation itself:
i.e. "C:\Program Files\Autodesk\3ds Max Design 2015\MacroScripts"

Or any other directiory you have specified for reading macroscripts when Max starts.

When you go to the "Customize User Interface" menu, you will find the macro under the Category "DAS Tools". Drag it to a toolbar.
If you need further help using a macroscript, please consult the 3ds max help files.


This script deletes all empty layers.
In max 2015 or above (at this time) it can keep ALL nested layers (user prompt) if any one of them has objects on it.
In other words, if a user chooses "Yes" at the query, ONLY layers with NO children AND no objects will be deleted. 
All nested hierarchies are maintained down to the last layer that has objects in it.
Choosing "No" at the prompt will unnest all layers and delete all empty layers

Please send any feedback to the address below.

Thanks!

David Sparks
www.digitalanimation.net
info@digitalanimation.net